function [hx, hf] = newton(fun,xn,e,m);
	
	hx = [];
	hf = [];
	k = 0;
	[f df] = feval(fun,xn,[1,1]);
	
	xn1 = xn - f/df;
	error_relativo = abs(xn1 - xn)/abs(xn1);
	hx = [hx,xn];
	hf = [hf,f];
	
	[f df] = feval(fun,xn1,[1,1]);
	while(abs(error_relativo) > e && abs(f) > e && k < m)

        xn = xn1;
		[f df] = feval(fun,xn,[1,1]);
	    xn1 = xn - f/df;
		error_relativo = abs(xn1 - xn )/abs(xn1);
        ++k;
		hx = [hx,xn];
		hf = [hf,f];
	endwhile
	
endfunction


